#!/usr/local/bin/perl -w

use Test::More qw(no_plan);
use lib "./lib";
use lib "../lib";

BEGIN {
   use_ok("Devel::Metadata");
}

use strict;

my ($dmd, @modules, $module, $module_def, $value);

$dmd = Devel::Metadata->new();

@modules = $dmd->modules();
#print "[all]\n", join("\n", sort @modules), "\n";

foreach $module (@modules) {
    $module_def = $dmd->module_def($module);
    print "$module";
    foreach (sort keys %$module_def) {
        $value = $module_def->{$_};
        next if (!defined $value);
        if (ref($value) eq "ARRAY") {
            print " $_=[", join(",",@$value), "]";
        }
        elsif (ref($value) eq "HASH") {
            print " $_={", join(",",%$value), "}";
        }
        else {
            print " $_=$value";
        }
    }
    print "\n";
}

@modules = $dmd->modules("CPAN");
print "[CPAN]\n", join("\n", sort @modules), "\n";

exit 0;

